home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 46 / Amiga Format CD46 (1999-10-20)(Future Publishing)(GB)[!][issue 1999-12].iso / -in_the_mag- / reader_requests / scilab / demos / bike / macros / velo4p.sci < prev    next >
Text File  |  1999-09-16  |  2KB  |  74 lines

  1. //[]=velo4p()
  2. // version with full wheels with  xgeom & xfpoly
  3. // ( geom performs the geometric calculations)
  4. t= t*180/%pi;
  5. p= p*180/%pi;
  6. xe=[xmin,xmax,xmax,xmin,xmin]
  7. ye=[ymin,ymin,ymax,ymax,ymin]
  8. param3d(xe,ye,zmin*ones(1,5),t,p," ",[1,0],rect);
  9. // Rajoutons nous des petits poteaux
  10. poteau(xmin,(ymin+ymax)/2,0.4,0.4)
  11. arbre(xmax,ymax,0.1,0.1)
  12. arbre((xmax+xmin)/2,(ymin+ymax)/2,0.1,0.1)
  13. xset("alufunction",6)
  14. [xnt,ynt]=geom3d(xf,yf,zf);
  15. [xnf,ynf]=geom3d(xfrontar,yfrontar,zfrontar);
  16. [xnr,ynr]=geom3d(xrearar,yrearar,zrearar);
  17. /////////////////////////////////////
  18. [n1,n2]=size(xfrontar);
  19. deff('[]=velod(i)',['xpoly(xnt(:,i),ynt(:,i),''lines'')';
  20.       'xfpoly(xnr(:,i),ynr(:,i))';
  21.       'xfpoly(xnf(:,i),ynf(:,i))']);
  22.  
  23. deff('[]=traj(i)',['j=i-1;';
  24.    'param3d(xprear(1,j:i),xprear(2,j:i),xprear(3,j:i),t,p,'" "',[0,0])';
  25.    'param3d(xpfront(1,j:i),xpfront(2,j:i),xpfront(3,j:i),t,p,'" "',[0,0])']);
  26.  
  27. comp(velod);comp(traj);
  28. //Caution: start at i=2
  29. for i=2:1:n2;velod(i);
  30. //traj();
  31. velod(i);end
  32. velod(n2);
  33. xset("alufunction",3);
  34. //end
  35.  
  36.  
  37. //[]=poteau(xcenter,ycenter,xep,yep)
  38. // rajoute un poteau de centre xcenter,ycenter)
  39. // d'epaisseur xep et yp 
  40. //!
  41. // Comment rajouter un petit cube
  42. xc=[xcenter-xep,xcenter-xep,xcenter+xep,xcenter+xep];
  43. yc=[ycenter-yep,ycenter-yep,ycenter+yep,ycenter+yep];
  44. zmat=zmin*ones(4,4);
  45. zmat(2:3,2:3)=zmax*ones(2,2);
  46. // grise du poteau 
  47. potg=10
  48. plot3d(xc,yc,zmat,t,p," ",[potg,0,0]);
  49. //end
  50.  
  51.  
  52. //[]=arbre(xcenter,ycenter,xep,yep)
  53. // rajoute un poteau de centre xcenter,ycenter)
  54. // d'epaisseur xep et yp 
  55. //!
  56. // Comment rajouter un petit cube
  57. xc=[xcenter-xep,xcenter-xep,xcenter+xep,xcenter+xep];
  58. yc=[ycenter-yep,ycenter-yep,ycenter+yep,ycenter+yep];
  59. zmat=zmin*ones(4,4);
  60. zmat(2:3,2:3)=zmax*ones(2,2);
  61. // grise du poteau 
  62. potg=10
  63. plot3d(xc,yc,zmat,t,p," ",[potg,0,0]);
  64. rand('uniform');
  65. teta=%pi*rand(1,100);
  66. phi=2*%pi*rand(1,100);
  67. r=[zmax-zmin];
  68. x=[xcenter*ones(1,100);xcenter*ones(1,100)+r*cos(teta).*cos(phi)];
  69. y=[ycenter*ones(1,100);ycenter*ones(1,100)+r*cos(teta).*sin(phi)];
  70. z=[zmax*ones(1,100);zmax*ones(1,100)+r*sin(teta)];
  71. [x,y]=geom3d(x,y,z);
  72. xsegs(x,y);
  73. //end
  74.